Imports System.Data.OleDb
Imports DTO

Public Class LoaiPhongDAO

    Inherits AbstractDAO

    Public Function Lay_Bang(ByVal chuoi_lenh As String) As DataTable
        Dim dt As New DataTable
        Dim chuoi_ket_noi As New OleDbConnection
        chuoi_ket_noi = AbstractDAO.ConnectionData()
        Dim bo_thich_ung As New OleDbDataAdapter(chuoi_lenh, chuoi_ket_noi)
        bo_thich_ung.FillSchema(dt, SchemaType.Mapped)
        bo_thich_ung.Fill(dt)
        Return dt
    End Function

    Public Sub ThemLoaiPhong(ByVal dr As DataRow)
        Dim cn As OleDbConnection
        cn = AbstractDAO.ConnectionData()
        Dim strSQL As String
        strSQL = "insert into LoaiPhong(TenLoaiPhong, DonGia, SoKhachToiDa) values(?,?,?)"
        Dim cmb As New OleDbCommand(strSQL, cn)
        cmb.Parameters.Add("@TenLoaiPhong", OleDbType.WChar)
        cmb.Parameters.Add("@DonGia", OleDbType.Integer)
        cmb.Parameters.Add("@SoKhachToiDa", OleDbType.Integer)

        cmb.Parameters("@TenLoaiPhong").Value = dr("TenLoaiPhong")
        cmb.Parameters("@DonGia").Value = dr("DonGia")
        cmb.Parameters("@SoKhachToiDa").Value = dr("SoKhachToiDa")
        cmb.ExecuteNonQuery()
        cn.Close()
    End Sub

End Class
